package tfts

type mentor int

const (
	KobukoM mentor = iota
	UdryM
	YasuoM
	RyzeM
)

func flexAttr(factor int, metas ...*attrMeta) *attrMeta {
	a := &attrMeta{factor: factor, fighter: &fighter{}}
	for _, meta := range metas {
		a.Add(meta)
	}
	return a
}

// 战斗学院
func (f *Fight) Academia(active int) *Fight {
	switch active {
	case 3:
		f.Var("pt", 3)
	case 5:
		f.Var("pt", 5)
	case 7:
		f.Var("pt", 7)
	default:
		panic("wrong origin num")
	}

	return f
}

// 大宗师
func (f *Fight) Mentor1(m mentor) *Fight {
	switch m {
	case KobukoM:
		f.Add(DR(7))
	case UdryM:
		f.Add(AD(10))
		f.Add(AP(10))
	case YasuoM:
		f.Add(AS(12))
	case RyzeM:
		f.Add(HitMana(2))
	}
	return f
}

// Superme
func (f *Fight) Superme(active int) *Fight {
	switch active {
	case 2:
		f.Add(AMP(12))
		f.Add(UnqAmp(5))
	case 3:
		f.Add(AMP(30))
		f.Add(UnqAmp(5))
	case 4:
		f.Add(AMP(50))
		f.Add(UnqAmp(5))
	}
	return f
}

// 星守
func (f *Fight) StarGuardian(active int) *Fight {
	switch active {
	case 3:
		f.Add(ManaAmp(0))
	case 5:
		f.Add(ManaAmp(0))
	case 7:
		f.Add(ManaAmp(0))
	default:
		panic("wrong origin num")
	}

	return f
}

// 怒兽
func (f *Fight) Luchador(active int) *Fight {
	a := NewAction(f).Once(8).On(TimeGoE)
	a.name = "Luchador"
	switch active {
	case 2:
		f.Add(AD(15))
		a.Heal = "20*hp"
	case 4:
		f.Add(AD(40))
		a.Heal = "40*hp"
	default:
		panic("wrong origin num")
	}

	return f
}

// 斗魂
func (f *Fight) SoulFighter(active int) *Fight {
	switch active {
	case 2:
		f.Add(HP(120))
		a := NewAction(f, AD(1), AP(1)).Stack(1, 8).On(TimeGoE)
		a.name = "SoulFighter"
		b := NewAction(f, UnqAmp(18)).Once(8).On(TimeGoE)
		b.name = "TrueDmg"
	case 4:
		f.Add(HP(200))
		a := NewAction(f, AD(2), AP(2)).Stack(1, 8).On(TimeGoE)
		a.name = "SoulFighter"
		b := NewAction(f, UnqAmp(29)).Once(8).On(TimeGoE)
		b.name = "TrueDmg"
	case 6:
		f.Add(HP(300))
		a := NewAction(f, AD(3), AP(3)).Stack(1, 8).On(TimeGoE)
		a.name = "SoulFighter"
		b := NewAction(f, UnqAmp(43)).Once(8).On(TimeGoE)
		b.name = "TrueDmg"
	case 8:
		f.Add(HP(450))
		a := NewAction(f, AD(4), AP(4)).Stack(1, 8).On(TimeGoE)
		a.name = "SoulFighter"
		b := NewAction(f, UnqAmp(65)).Once(8).On(TimeGoE)
		b.name = "TrueDmg"
	default:
		panic("wrong origin num")
	}

	return f
}

// 小怪兽训练师
func (f *Fight) MonsterTamer(active int) *Fight {
	switch active {
	case 1:
		f.Add(AP(0))
	case 2:
		f.Add(AP(0))
	case 3:
		f.Add(AP(0))
	case 4:
		f.Add(AP(0))
	default:
		panic("wrong origin num")
	}

	return f
}

// 霸天机甲
func (f *Fight) Mecha() *Fight {
	f.Add(OMP(10))
	//switch active {
	//case 2:
	//	f.Add(AP(0))
	//case 4:
	//	f.Add(AP(0))
	//case 6:
	//	f.Add(AP(0))
	//default:
	//	panic("wrong origin num")
	//}
	return f
}

// 奥德赛
func (f *Fight) Crew(active int) *Fight {
	switch active {
	case 3:
		f.Add(UnqAmp(39))
	case 4:
		f.Add(UnqAmp(46))
	case 5:
		panic("todo")
	}
	return f
}

// 至高天
func (f *Fight) Wraith(active int) *Fight {
	switch active {
	case 2:
		f.Add(UnqAmp(18))
	case 4:
		f.Add(UnqAmp(35))
	case 6:
		f.Add(UnqAmp(55))
	default:
		panic("wrong origin num")
	}
	return f
}

// 灵能特工
func (f *Fight) Psyops(active int) *Fight {
	return f
}
